package com.songtai.action.admin.introduce;

import com.songtai.action.SongtaiActionSupport;
import com.songtai.po.Introduce;
import com.songtai.service.IntroduceService;
import com.songtai.util.CommenUtil;

/**
 * @author 赵中杨
 * @email zhaozhongyang717@gmail.com
 * @date 2010 2010-4-20 下午04:27:26
 */
public class IntroduceAction extends SongtaiActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1459156130585764201L;
	private String id;
	private Long nodeid;
	private String content;
	private Introduce introduce;
	private IntroduceService introduceService;
	private String method;

	/**
	 * 获取介绍
	 * 
	 * @return
	 * @throws Exception
	 */
	public String getIntroduceById() throws Exception {
		introduce = introduceService.getIntroduceByNid(nodeid);
		if (!CommenUtil.isEmpty(method)) {
			return LOGIN;
		}
		return SUCCESS;
	}

	/**
	 * 更新介绍
	 * 
	 * @return
	 * @throws Exception
	 */
	public String updateIntroduce() throws Exception {
		System.out.println(introduce.getId());
		System.out.println(introduce.getContent());
		System.out.println(nodeid);
		introduceService.updateIntroduce(introduce);
		addActionMessage(getText("edit.success"));
		return SUCCESS;
	}

	/**
	 * 添加介绍
	 * 
	 * @return
	 * @throws Exception
	 */
	public String addIntroduce() throws Exception {
		if (nodeid<1) {
			return null;
		}
		Introduce intro = new Introduce();
		intro.setContent(content);
		intro.setNid(nodeid);
		introduceService.addIntroduce(intro);
		addActionMessage(getText("add.success"));
		return SUCCESS;
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}


	/**
	 * @return the nodeid
	 */
	public Long getNodeid() {
		return nodeid;
	}

	/**
	 * @param nodeid the nodeid to set
	 */
	public void setNodeid(Long nodeid) {
		this.nodeid = nodeid;
	}

	/**
	 * @return the introduce
	 */
	public Introduce getIntroduce() {
		return introduce;
	}

	/**
	 * @param introduce
	 *            the introduce to set
	 */
	public void setIntroduce(Introduce introduce) {
		this.introduce = introduce;
	}

	/**
	 * @return the introduceService
	 */
	public IntroduceService getIntroduceService() {
		return introduceService;
	}

	/**
	 * @param introduceService
	 *            the introduceService to set
	 */
	public void setIntroduceService(IntroduceService introduceService) {
		this.introduceService = introduceService;
	}

	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @param content
	 *            the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * @return the method
	 */
	public String getMethod() {
		return method;
	}

	/**
	 * @param method
	 *            the method to set
	 */
	public void setMethod(String method) {
		this.method = method;
	}

}
